
package com.submaxim_testdb;

import java.util.List;
import com.submaxim_testdb.data.Accounts;
import com.submaxim_testdb.data.Authsmtpdomains;
import com.submaxim_testdb.data.Authsmtpmail;
import com.submaxim_testdb.data.PermissionsLogin;
import com.submaxim_testdb.data.ProductPlans;
import com.submaxim_testdb.data.Subscriptions;
import com.submaxim_testdb.data.output.GetAuthsmtpmail_AuthsmtpdomainsRtnType;
import com.submaxim_testdb.data.output.GetProductplanAndTransactionByIdRtnType;
import com.submaxim_testdb.data.output.MyUserIdQueryRtnType;
import com.wavemaker.json.type.TypeDefinition;
import com.wavemaker.runtime.data.DataServiceManager;
import com.wavemaker.runtime.data.DataServiceManagerAccess;
import com.wavemaker.runtime.data.TaskManager;
import com.wavemaker.runtime.service.LiveDataService;
import com.wavemaker.runtime.service.PagingOptions;
import com.wavemaker.runtime.service.PropertyOptions;
import com.wavemaker.runtime.service.TypedServiceReturn;


/**
 *  Operations for service "submaxim_testDB"
 *  01/20/2012 12:39:28
 * 
 */
@SuppressWarnings("unchecked")
public class Submaxim_testDB
    implements DataServiceManagerAccess, LiveDataService
{

    private DataServiceManager dsMgr;
    private TaskManager taskMgr;

    public Integer subscriptions_bulkMarketing_maximailCredit(Integer maximailsCredits, Boolean maximailsActive, Integer userId, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.subscriptions_bulkMarketing_maximailCreditQueryName), maximailsCredits, maximailsActive, userId, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public Integer accounts_balance_authSMPT(Integer bal, Integer userId, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.accounts_balance_authSMPTQueryName), bal, userId, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public List<Authsmtpmail> authsmtpmailTB() {
        return ((List<Authsmtpmail> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.AuthsmtpmailTBQueryName)));
    }

    public List<com.submaxim_testdb.data.Transactions> transactionsTB() {
        return ((List<com.submaxim_testdb.data.Transactions> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.TransactionsTBQueryName)));
    }

    public List<Subscriptions> subscriptionsTB(PagingOptions pagingOptions) {
        return ((List<Subscriptions> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.subscriptionsTBQueryName), pagingOptions));
    }

    public List<ProductPlans> productPlansTB() {
        return ((List<ProductPlans> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.ProductPlansTBQueryName)));
    }

    public List<Accounts> accountbyUserId(Integer id) {
        return ((List<Accounts> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.AccountbyUserIdQueryName), id));
    }

    public List<PermissionsLogin> getExistingLogin(Integer id, PagingOptions pagingOptions) {
        return ((List<PermissionsLogin> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.getExistingLoginQueryName), id, pagingOptions));
    }

    public Integer subscription_webMail(Integer webmailCredits, Boolean webmailActive, Integer userId, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.subscription_webMailQueryName), webmailCredits, webmailActive, userId, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public List<com.submaxim_testdb.data.Transactions> getTransactionsById(Integer id, PagingOptions pagingOptions) {
        return ((List<com.submaxim_testdb.data.Transactions> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.getTransactionsByIdQueryName), id, pagingOptions));
    }

    public List<com.submaxim_testdb.data.PermissionsGroup> getPermissionsByGrpId(Integer grpid, PagingOptions pagingOptions) {
        return ((List<com.submaxim_testdb.data.PermissionsGroup> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.getPermissionsByGrpIdQueryName), grpid, pagingOptions));
    }

    public List<MyUserIdQueryRtnType> myUserIdQuery(Integer id, PagingOptions pagingOptions) {
        return ((List<MyUserIdQueryRtnType> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.myUserIdQueryQueryName), id, pagingOptions));
    }

    public Integer authSmtp__NewDomain_update_authenticated_domain_postfix(Integer userId, String authenticatedDomain, String companyDomain, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.authSmtp__NewDomain_update_authenticated_domain_postfixQueryName), userId, authenticatedDomain, companyDomain, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public List<Authsmtpdomains> authsmtpdomainsTB() {
        return ((List<Authsmtpdomains> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.AuthsmtpdomainsTBQueryName)));
    }

    public List<com.submaxim_testdb.data.Transactions> transactionsUserId(Integer id) {
        return ((List<com.submaxim_testdb.data.Transactions> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.TransactionsUserIdQueryName), id));
    }

    public Integer subscriptions_emailEditor_emailCredits(Integer emaileditorCredits, Boolean emaileditorActive, Integer userId, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.subscriptions_emailEditor_emailCreditsQueryName), emaileditorCredits, emaileditorActive, userId, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public Integer subscriptions_authsmtpActive_authSMPT(Boolean authsmtpActive, Integer userId, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.subscriptions_authsmtpActive_authSMPTQueryName), authsmtpActive, userId, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public List<GetProductplanAndTransactionByIdRtnType> getProductplanAndTransactionById(Integer id, PagingOptions pagingOptions) {
        return ((List<GetProductplanAndTransactionByIdRtnType> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.getProductplanAndTransactionByIdQueryName), id, pagingOptions));
    }

    public List<GetAuthsmtpmail_AuthsmtpdomainsRtnType> getAuthsmtpmail_Authsmtpdomains(Integer id, PagingOptions pagingOptions) {
        return ((List<GetAuthsmtpmail_AuthsmtpdomainsRtnType> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.getAuthsmtpmail_AuthsmtpdomainsQueryName), id, pagingOptions));
    }

    public List<com.submaxim_testdb.data.PermissionsGroup> getExistingGroups(Integer id, PagingOptions pagingOptions) {
        return ((List<com.submaxim_testdb.data.PermissionsGroup> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.getExistingGroupsQueryName), id, pagingOptions));
    }

    public Integer subscriptions_emaildelivery_emaildeliveryCredits(Integer emaildeliveryCredits, Boolean emaildeliveryActive, Integer userId, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.subscriptions_emaildelivery_emaildeliveryCreditsQueryName), emaildeliveryCredits, emaildeliveryActive, userId, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public Integer subscriptions_spamScore_spamscoreCredits(Integer spamscoreCredits, Boolean spamscoreActive, Integer userId, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.subscriptions_spamScore_spamscoreCreditsQueryName), spamscoreCredits, spamscoreActive, userId, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public Integer subscriptions_transaction_Cancel_renew(Boolean renew, Integer userId, Byte planId, PagingOptions pagingOptions) {
        List<Integer> rtn = ((List<Integer> ) dsMgr.invoke(taskMgr.getQueryTask(), (Submaxim_testDBConstants.subscriptions_transaction_Cancel_renewQueryName), renew, userId, planId, pagingOptions));
        if (rtn.isEmpty()) {
            return null;
        } else {
            return rtn.get(0);
        }
    }

    public Object insert(Object o) {
        return dsMgr.invoke(taskMgr.getInsertTask(), o);
    }

    public TypedServiceReturn read(TypeDefinition rootType, Object o, PropertyOptions propertyOptions, PagingOptions pagingOptions) {
        return ((TypedServiceReturn) dsMgr.invoke(taskMgr.getReadTask(), rootType, o, propertyOptions, pagingOptions));
    }

    public Object update(Object o) {
        return dsMgr.invoke(taskMgr.getUpdateTask(), o);
    }

    public void delete(Object o) {
        dsMgr.invoke(taskMgr.getDeleteTask(), o);
    }

    public void begin() {
        dsMgr.begin();
    }

    public void commit() {
        dsMgr.commit();
    }

    public void rollback() {
        dsMgr.rollback();
    }

    public DataServiceManager getDataServiceManager() {
        return dsMgr;
    }

    public void setDataServiceManager(DataServiceManager dsMgr) {
        this.dsMgr = dsMgr;
    }

    public TaskManager getTaskManager() {
        return taskMgr;
    }

    public void setTaskManager(TaskManager taskMgr) {
        this.taskMgr = taskMgr;
    }

}
